package com.sl.biz.modular.process.service.impl;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.sl.biz.modular.process.dao.domain.dto.ProcessCompVersionBuildDTO;
import com.sl.biz.modular.process.dao.domain.entity.ProcessCompVersionBuildDO;
import com.sl.biz.modular.process.dao.service.ProcessCompVersionBuildDaoService;
import com.sl.biz.modular.process.service.ProcessCompVersionBuildService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class ProcessCompVersionBuildServiceImpl implements ProcessCompVersionBuildService {
    private final ProcessCompVersionBuildDaoService buildDaoService;

    @Override
    public ProcessCompVersionBuildDTO getLastCodeAndVersion(ProcessCompVersionBuildDO processCompVersionBuildDO) {
        String compVersion = processCompVersionBuildDO.getCompVersion();
        String compCode = processCompVersionBuildDO.getCompCode();
        ProcessCompVersionBuildDTO processCompVersionBuildDTO = buildDaoService.queryLastBuild(compCode, compVersion);
        return processCompVersionBuildDTO;
    }

    @Override
    public void save(ProcessCompVersionBuildDO buildDO) {
        buildDaoService.save(buildDO);
    }

    @Override
    public void updateById(ProcessCompVersionBuildDO buildDO) {
        buildDaoService.updateById(buildDO);
    }

    @Override
    public Boolean removeByCodeAndVersion(String compCode, String compVersion) {
        return buildDaoService.removeByCompCodeAndVersion(compCode, compVersion);
    }
}
